package demoMod.nanaki.powers;

import com.evacipated.cardcrawl.mod.stslib.powers.abstracts.TwoAmountPower;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.PutOnDeckAction;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.PowerStrings;
import demoMod.nanaki.NanakiMod;
import demoMod.nanaki.utils.PowerRegionLoader;

public class PoetryPower extends TwoAmountPower {
    public static final String POWER_ID = NanakiMod.makeID("PoetryPower");
    private static final PowerStrings powerStrings;
    public static final String NAME;
    public static final String[] DESC;

    public PoetryPower(AbstractCreature owner, int amount) {
        this.name = NAME;
        this.ID = POWER_ID;
        this.owner = owner;
        this.amount = amount;
        this.amount2 = 1;
        this.updateDescription();
        PowerRegionLoader.load(this);
    }

    @Override
    public void stackPower(int stackAmount) {
        super.stackPower(stackAmount);
        this.amount2++;
    }

    @Override
    public void updateDescription() {
        this.description = String.format(DESC[0], this.amount, this.amount2);
    }

    @Override
    public void atStartOfTurnPostDraw() {
        this.flash();
        addToBot(new DrawCardAction(this.amount));
        addToBot(new PutOnDeckAction(owner, owner, this.amount2, false));
    }

    static {
        powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID);
        NAME = powerStrings.NAME;
        DESC = powerStrings.DESCRIPTIONS;
    }
}
